Skip to content

feat(mcp): Support stateless SDK v2 handlers - #1165

Merged
dcramer merged 6 commits into
mainfrom
feat/agents-mcp-v2-handler
Jul 20, 2026
Merged

feat(mcp): Support stateless SDK v2 handlers#1165
dcramer merged 6 commits into
mainfrom
feat/agents-mcp-v2-handler

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Upgrade the hosted MCP endpoint to Cloudflare Agents' new stateless SDK v2 handler while preserving the existing SDK v1 server path for stdio and other consumers.

Dual SDK server construction

buildServer now defaults to the existing @modelcontextprotocol/sdk v1 server and can explicitly construct an @modelcontextprotocol/server v2 server for draft-protocol handlers. The Cloudflare endpoint passes a server factory to createMcpHandler, giving every request a fresh server instance as required by the new handler contract.

Pinned beta dependency set

Pins agents@canva, @modelcontextprotocol/server@2.0.0-beta.4, and @modelcontextprotocol/sdk@1.29.0. Supporting React and AI SDK peers are updated to versions accepted by the canva build. The endpoint also restricts browser Origins to its serving hostname.

The v2 SDK and draft MCP protocol remain beta; these pins should be revisited when Cloudflare publishes the stable Agents release.

Requested by David Cramer via Junior.

--

View Junior Session

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: David Cramer <david@sentry.io>
Comment thread packages/mcp-cloudflare/src/server/lib/mcp-handler.ts Outdated
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: David Cramer <david@sentry.io>
@dcramer
dcramer marked this pull request as ready for review July 17, 2026 23:58
Co-Authored-By: OpenAI Codex <codex@openai.com>
Co-Authored-By: David Cramer <david@sentry.io>
Comment thread packages/mcp-core/src/server.ts Outdated
Co-Authored-By: OpenAI Codex <codex@openai.com>
Comment thread packages/mcp-core/src/server.ts Outdated
sentry-junior Bot and others added 2 commits July 18, 2026 01:08
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: David Cramer <david@sentry.io>
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: David Cramer <david@sentry.io>
@dcramer
dcramer merged commit c45051e into main Jul 20, 2026
21 checks passed
@dcramer
dcramer deleted the feat/agents-mcp-v2-handler branch July 20, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant